const model = /^\s([v-]+?)/
const fn = /^\s([\@]+?)/
function directive(attrsString){
  const result = [];
  if(model.test(attrsString)){
    var dir = /^\s([v-]+[model].+)="(.+)"$/;
    var directive = attrsString.match(dir)
    result.push({name:"model",value:directive[2],rawName:"v-model"})
  }
  return result;
}
function events(attrsString){
  const obj = {}
  if(model.test(attrsString)){
    var dir = /^\s([v-]+[model].+)="(.+)"$/;
    var directive = attrsString.match(dir)
    obj.input = {}
    obj.input.dynamic = undefined;
    obj.input.input = `if($event.target.composing)return;${directive[2]}=$event.target.value`
  }
  if(fn.test(attrsString)){
    var str = attrsString.match(/^\s\@(.+)="(.+)"$/)
    var fnName = str[1]
    var fnValue = str[2]
    obj[fnName] = {}
    obj[fnName].dynamic = false;
    obj[fnName].value = fnValue;

  }
  return obj;
}
export {directive,events}